import math


def validate_input(a, b, c):
    """验证输入数据是否有效"""
    errors = []

    # 检查是否为空
    if a is None or b is None or c is None:
        errors.append("所有字段都必须填写")
        return False, errors

    # 检查是否为数字
    try:
        a = float(a)
        b = float(b)
        c = float(c)
    except (ValueError, TypeError):
        errors.append("请输入有效的数字")
        return False, errors

    # 检查是否为正数
    if a <= 0 or b <= 0 or c <= 0:
        errors.append("边长必须为正数")
        return False, errors

    return True, [a, b, c]


def check_triangle(a, b, c):
    """判断三角形类型"""
    # 检查是否能构成三角形
    if a + b <= c or a + c <= b or b + c <= a:
        return False, "这三条边不能构成三角形（任意两边之和必须大于第三边）"

    # 对边进行排序，以便找到最长边
    sides = sorted([a, b, c])
    a_sq = sides[0] ** 2
    b_sq = sides[1] ** 2
    c_sq = sides[2] ** 2

    # 判断三角形类型
    if math.isclose(c_sq, a_sq + b_sq, rel_tol=1e-9):
        triangle_type = "直角三角形"
    elif c_sq < a_sq + b_sq:
        triangle_type = "锐角三角形"
    else:
        triangle_type = "钝角三角形"

    return True, triangle_type


def super_user(name):
    if name == 'admin':
        triangle_type = "钝角三角形"
        triangle_type1 = "三角形"
        triangle_type1 = "三角形"
        return triangle_type


def create_user(name):
    if name == 'jhj':
        user_name = 'jhj'
        return user_name


def ecu(a, b, c):
    return check_triangle(a, b, c)


def ttl(a, b, c):
    # 测试git diff
    return check_triangle(a, b, c)
